﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace SMS.dao
{
    public class RegistrationDao
    {
        private static readonly RegistrationDao INSTANCE = new RegistrationDao();

        public static RegistrationDao Instance
        {
            get
            {
                return INSTANCE;
            }
        }

        private RegistrationDao() { }

        public int insert(int studentId, int classId)
        {
            String sql = "insert into registration values(@stuId, @claId)";
            DataFetcher.Instance.setCommand(sql, 1);
            DataFetcher.Instance.addParameter(new SqlParameter("@stuId", studentId));
            DataFetcher.Instance.addParameter(new SqlParameter("@claId", classId));
            return DataFetcher.Instance.execute();
        }

        public int delete(int studentId, int classId)
        {
            String sql = "delete from registration where stu_id = @stuId and cla_id = @claId";
            DataFetcher.Instance.setCommand(sql, 1);
            DataFetcher.Instance.addParameter(new SqlParameter("@stuId", studentId));
            DataFetcher.Instance.addParameter(new SqlParameter("@claId", classId));
            return DataFetcher.Instance.execute();
        }

        public int insertUser(string UserName, string Userpazz)
        {
            String sql = "insert into usr values(@USR_NAME, @USR_PASS)";
            DataFetcher.Instance.setCommand(sql, 1);
            DataFetcher.Instance.addParameter(new SqlParameter("@stuId", UserName));
            DataFetcher.Instance.addParameter(new SqlParameter("@claId", Userpazz));
            return DataFetcher.Instance.execute();
        }

        internal System.Data.DataTable findBlockName(string blockName)
        {
            throw new NotImplementedException();
        }

        internal System.Data.DataTable Findusername(string Findusername)
        {
            throw new NotImplementedException();
        }

        internal System.Data.DataTable Findpass(string Findusername)
        {
            throw new NotImplementedException();
        }
    }
}
